import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "@/views/Layout";
import Home from "@/views/Home";
import Search from "@/views/Search";
import Message from "@/views/Message";
import MyInfo from "@/views/MyInfo";
import Login from "@/views/Login";
import Map from "@/views/Map";
import NotFound from "@/views/NotFound";
import MyHouse from "@/views/MyHouse";
import Rent from "@/views/Rent";
import City from "@/views/city";
import Favorate from "@/views/Favorate";
import Detail from "@/views/Detail";
import HouseMessage from "@/views/HouseMessage";
import RentSearch from "@/views/RentSearch";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/layout",
  },
  {
    path: "/layout",
    component: Layout,
    redirect: "/layout/home",
    children: [
      {
        path: "home",
        component: Home,
      },
      {
        path: "search",
        component: Search,
      },
      {
        path: "message",
        component: Message,
      },
      {
        path: "myinfo",
        component: MyInfo,
      },
    ],
  },
  {
    path: "/login",
    component: Login,
  },
  {
    path: "/city",
    component: City,
  },
  {
    path: "/map",
    component: Map,
  },
  {
    path: "/myhouse",
    component: MyHouse,
  },
  {
    path: "/favorate",
    component: Favorate,
  },
  {
    path: "/detail",
    component: Detail,
    children: [
      {
        path: "housemessage",
        component: HouseMessage,
      },
    ],
  },
  {
    path: "/rent",
    component: Rent,
    name: "Rent",
  },
  {
    path: "/rentsearch",
    component: RentSearch,
  },
  {
    path: "*",
    component: NotFound,
  },
];

export default new VueRouter({
  routes,
});
